package innerclass.a04demo4;

public class Test {
    public static void main(String[] args) {
        new Swim() {

            @Override
            public void swim() {
                System.out.println("我会游泳");
            }
        };
        new Animal() {

            @Override
            public void eat() {
                System.out.println("我会吃");
            }
        };
        method(new Animal() {
            @Override
            public void eat() {
                System.out.println("我会吃");
            }
        });
    }

    public static void method(Animal a) {
        a.eat();
    }
}

abstract class Animal {
    public abstract void eat();
}